#!/bin/bash 
# 
# tomcat startup script for the Tomcat server 
# 
# chkconfig: 345 80 20 
# description: start the tomcat deamon 
# 
# Source function library 
. /etc/init.d/functions 
prog=tomcat 
JAVA_HOME=/usr/local/jdk1.8
export JAVA_HOME 
CATALINA_HOME=/usr/local/tomcat/
export CATALINA_HOME 
case "$1" in 
start) 
  echo "Starting Tomcat..." 
  $CATALINA_HOME/bin/startup.sh 
  ;; 
stop) 
  echo "Stopping Tomcat..." 
  $CATALINA_HOME/bin/shutdown.sh 
  ;; 
restart) 
  echo "Stopping Tomcat..." 
  $CATALINA_HOME/bin/shutdown.sh 
  sleep 2 
  echo 
  echo "Starting Tomcat..." 
  $CATALINA_HOME/bin/startup.sh 
  ;; 
*) 
  echo "Usage: $prog {start|stop|restart}" 
  ;; 
esac 
exit 0